package carassius.GUI;

import java.awt.Font;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.util.ResourceBundle;
import javax.swing.AbstractAction;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.text.DefaultEditorKit.CopyAction;
import javax.swing.text.DefaultEditorKit.CutAction;
import javax.swing.text.DefaultEditorKit.PasteAction;

/**
 *
 * @author siebz0r
 */
public class CopyPastePopupMenu
		extends JPopupMenu
{
	public CopyPastePopupMenu()
	{
		ResourceBundle resourceBundle = ResourceBundle.getBundle("carassius.GUI.resources.PopupMenu");

		JMenuItem cutMenuItem = new JMenuItem();
		cutMenuItem.setAction(new CutAction());
		cutMenuItem.setText(resourceBundle.getString("Cut"));
		cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK));
		cutMenuItem.setFont(cutMenuItem.getFont().deriveFont(Font.PLAIN));
		add(cutMenuItem);

		JMenuItem copyMenuItem = new JMenuItem();
		copyMenuItem.setAction(new CopyAction());
		copyMenuItem.setText(resourceBundle.getString("Copy"));
		copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK));
		copyMenuItem.setFont(copyMenuItem.getFont().deriveFont(Font.PLAIN));
		add(copyMenuItem);

		JMenuItem pasteMenuItem = new JMenuItem();
		pasteMenuItem.setAction(new PasteAction());
		pasteMenuItem.setText(resourceBundle.getString("Paste"));
		pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
		pasteMenuItem.setFont(pasteMenuItem.getFont().deriveFont(Font.PLAIN));
		add(pasteMenuItem);
	}
}
